<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>耕地分类变更表表单</title>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <!--按钮栏-->
            <div class="form-group button-bar button-bar">
               <!-- <button type="button" isShow="joForm.isAdd" class="btn btn-primary" onclick="joForm.save1()">
                    <i class="fa fa-plus-circle" aria-hidden="true"></i>&nbsp;新增
                </button>
                <button type="button" isShow="!joForm.isAdd" class="btn btn-info" onclick="joForm.update()">
                    <i class="fa fa-pencil-square" aria-hidden="true"></i>&nbsp;修改
                </button>
                <button type="button" isShow="!joForm.isAdd" class="btn btn-danger" onclick="joForm.del()">
                    <i class="fa fa-trash" aria-hidden="true"></i>&nbsp;删除
                </button>-->
                <!--按钮占位符.加载到的按钮会渲染到占位符里面-->
                <!--<span class="young-button-placeholder" navigateId="LAND_CHANGE_FORM_BUTTON"></span>-->
            </div>
            <!--按钮栏-->
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <form id="pageForm" name="pageForm" action="" method="post">
                <!--<div class="young-form-item col-md-6 must" style="display: none">
                    <div class="young-form-label">主键ID</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="id" value="" class="form-control readonly-edit"
                               ErrNumber="主键ID需填写数字类型"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 " style="display: none">
                    <div class="young-form-label">序号</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="serialnumber" value="" class="form-control "/>
                    </div>
                </div>-->
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">编号</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="organizationcode" readonly value="" class="form-control " ErrEmpty="编号不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">行政区划</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="regions" value="" readonly class="form-control " ErrEmpty="行政区划不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">地块名称</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="landname" value="" readonly class="form-control " ErrEmpty="地块名称不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">类别名称</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="typename" value="" readonly class="form-control " ErrEmpty="类别名称不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">耕地类型</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="cultivatedland" value="" readonly class="form-control " ErrEmpty="耕地类型不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">经度</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="longitude" value="" readonly class="form-control " ErrEmpty="经度不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">纬度</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="dimension" value="" readonly class="form-control " ErrEmpty="纬度不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 " style="display: none">
                    <div class="young-form-label">变更次数</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="changetimes" readonly value="" readonly class="form-control "/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">变更前类别名称</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <select name="typenamebefore" value="" readonly class="form-control" ErrEmpty="变更前类别名称不允许为空">
                            <option value="优先保护类耕地">优先保护类耕地</option>
                            <option value="安全利用类耕地">安全利用类耕地</option>
                            <option value="严格管控类耕地">严格管控类耕地</option>
                        </select>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">变更后类别名称</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <select name="typenameafter" value="" readonly class="form-control" ErrEmpty="变更后类别名称不允许为空">
                            <option value="优先保护类耕地">优先保护类耕地</option>
                            <option value="安全利用类耕地">安全利用类耕地</option>
                            <option value="严格管控类耕地">严格管控类耕地</option>
                        </select>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">变更时间</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" id="changetime" value="" readonly name="changetime" class="form-control "
                               ErrEmpty="变更时间不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">变更人</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="changepeople" value="" readonly class="form-control " ErrEmpty="变更人不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 must">
                    <div class="young-form-label">变更原因</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="causeofchange" value="" readonly class="form-control " ErrEmpty="变更原因不允许为空"/>
                    </div>
                </div>
                <div class="young-form-item col-md-6 " style="display: none">
                    <div class="young-form-label">权属</div>
                    <div class="young-form-tips"></div>
                    <div class="young-form-input-block">
                        <input type="text" name="ownership" value="" readonly class="form-control "/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    layui.laydate.render({
        elem: '#changetime' //注册日期控件
    });
    $(function () {
        var jParams = {
            "PKName": "id",//主键属性名
            "saveAfter": "toEdit",
            "addUrl": "/nyd/uviCultivatechange/insert",//新增
            "deleteUrl": "/nyd/uviCultivatechange/delete",//删除
            "updateUrl": "/nyd/uviCultivatechange/update",//修改
            "formDataUrl": "/nyd/uviCultivatechange/get",//查询
            //"readonly2Label" : true //只读转文本
        };
        joForm.initFormPage(jParams);//初始化
        initButton();
    });

    joForm.save = function(sUrl,callBack){
        sUrl = jo.getDefVal(sUrl,joForm.params["addUrl"]);
        if(jo.isValid(sUrl)){
            if(!joForm.isAdd){
                jo.showMsg("表单状态异常:joForm.isAdd="+joForm.isAdd);
            }else{
                var oData = jo.form2Json(joForm.params["formObj"]);
                //保存前对表单数据的处理
                if(typeof(joForm.dealDataAtSaveBefore) == "function"){
                    joForm.dealDataAtSaveBefore(oData);
                }
                //表单验证
                if(typeof (joForm.checkForm) == "function"){
                    if(!joForm.checkForm(joForm.form)){
                        return;
                    }
                }else{
                    if(!jo.checkForm(joForm.form)){//验证不通过直接返回
                        return;
                    }
                }
                jo.postAjax(sUrl,oData, function(result){
                    if(result.code == 0){
                        if(typeof(callBack) == "function"){//回调
                            callBack(result);
                        }else if(typeof(joForm.saveSuccessAfter) == "function"){
                            joForm.saveSuccessAfter(result);
                        }else{//默认新增成功处理
                            var joViewWindow = joForm.getJoViewWindow();//获取打开本窗口的joView页面window对象
                            try{
                                //window.parent.reloadCurrentPage();//重新加载joView页面数据
                                joViewWindow.reloadCurrentPage();
                            }catch(err){}
                            if(joForm.params["saveAfter"] == "toEdit" && jo.isValid(oData[joForm.params["PKName"]])){//保存之后的操作,toEdit表示去编辑
                                window.location.href = window.location.href+jo.getLinkSign(window.location.href)+joForm.params["PKName"]+"="+oData[joForm.params["PKName"]];
                            }else{
                                //window.parent.jo.close('WIN_ADD');
                                jo.closeSelf('WIN_ADD');
                            }
                            window.parent.jo.showMsg("保存成功!");
                        }
                    }else{
                        jo.showMsg(result.info)
                    }
                });

            }
        }else{
            jo.showMsg("{addUrl}无效!");
        }
    };

    /*joForm.save1 = function(sUrl,callBack){
        sUrl = jo.getDefVal(sUrl,joForm.params["addUrl"]);
        if(jo.isValid(sUrl)){
            if(!joForm.isAdd){
                jo.showMsg("表单状态异常:joForm.isAdd="+joForm.isAdd);
            }else{
                var oData = jo.form2Json(joForm.params["formObj"]);
                //保存前对表单数据的处理
                if(typeof(joForm.dealDataAtSaveBefore) == "function"){
                    joForm.dealDataAtSaveBefore(oData);
                }
                //表单验证
                if(typeof (joForm.checkForm) == "function"){
                    if(!joForm.checkForm(joForm.form)){
                        return;
                    }
                }else{
                    if(!jo.checkForm(joForm.form)){//验证不通过直接返回
                        return;
                    }
                }
                jo.postAjax(sUrl,oData, function(result){
                    if(result.code == 0){
                        if(typeof(callBack) == "function"){//回调
                            callBack(result);
                        }else if(typeof(joForm.saveSuccessAfter) == "function"){
                            joForm.saveSuccessAfter(result);
                        }else{//默认新增成功处理
                            var joViewWindow = joForm.getJoViewWindow();//获取打开本窗口的joView页面window对象
                            try{
                                //window.parent.reloadCurrentPage();//重新加载joView页面数据
                                joViewWindow.reloadCurrentPage();
                            }catch(err){}
                            if(joForm.params["saveAfter"] == "toEdit" && jo.isValid(oData[joForm.params["PKName"]])){//保存之后的操作,toEdit表示去编辑
                                window.location.href = window.location.href+jo.getLinkSign(window.location.href)+joForm.params["PKName"]+"="+oData[joForm.params["PKName"]];
                            }else{
                                //window.parent.jo.close('WIN_ADD');
                                jo.closeSelf('WIN_ADD');
                            }
                            window.parent.jo.showMsg("保存成功!");
                        }
                    }else{
                        jo.showMsg(result.info)
                    }
                });

            }
        }else{
            jo.showMsg("{addUrl}无效!");
        }
    };*/


    //初始化新增页面回调函数(在初始化按钮前发生)
    joForm.initFormPageOfAdd = function () {

    };
    //初始化表单值前处理
    joForm.initFormValueBefore = function (oJson) {
        oJson.changetime = jo.formatDate(oJson.changetime);
    };
    //初始化表单值后处理
    joForm.initFormValueAfter = function (oJson) {

    };
    //新增请求提交前回调函数
    joForm.dealDataAtSaveBefore = function (oJson) {

    };
    //修改请求提交前回调函数
    joForm.dealDataAtUpdateBefore = function (oJson) {

    };
    /* 关于joForm更多回调函数和配置参数可查看jo-page-form.js */
</script>
</body>
</html>
